package sojo.com.inverter.enums;


/**
 * @author cheng_hu
 * @description: 告警1
 * @date 2023-02-25 14:04:43
 */
public enum AlarmEnum_2 {
    Alarm_0(0, 2051, "残余电流异常", "重要"),
    Alarm_1(1, 2061, "系统接地异常", "重要"),
    Alarm_2(2, 2062, "绝缘阻抗低", "重要"),
    Alarm_3(3, 2063, "温度过高", "次要"),
    Alarm_4(4, 2064, "设备异常", "重要"),
    Alarm_5(5, 2065, "升级失败或版本不匹配", "次要"),
    Alarm_6(6, 2066, "License到期", "提示"),
    Alarm_7(7, 61440, "监控单元故障", "次要"),
    Alarm_8(8, 2067, "功率采集器故障[2]", "重要"),
    Alarm_9(9, 2068, "储能设备异常", "次要"),
    Alarm_10(10, 2070, "主动孤岛", "重要"),
    Alarm_11(11, 2071, "被动孤岛", "重要"),
    Alarm_12(12, 2072, "瞬时交流过压", "重要"),
    Alarm_13(13, 2075, "外部设备端口短路[3]", "提示"),
    Alarm_14(14, 2077, "离网输出过载[4]", "重要"),
    Alarm_15(15, 2080, "电池板配置异常", "重要");


    private int bit; //bit值
    private int alarmId; //告警ID
    private String alarmName; //告警名称
    private String alarmLevel; //告警级别
    AlarmEnum_2(int bit, int alarmId, String alarmName, String alarmLevel) {
        this.bit = bit;
        this.alarmId = alarmId;
        this.alarmName = alarmName;
        this.alarmLevel = alarmLevel;
    }

    public static String getAlarmName(int bit) {
        for (AlarmEnum_2 alarmEnum : AlarmEnum_2.values()) {
            if (bit == alarmEnum.getBit()) {
                return alarmEnum.getAlarmName();
            }
        }
        return "";
    }

    public static int getAlarmId(int bit) {
        for (AlarmEnum_2 alarmEnum : AlarmEnum_2.values()) {
            if (bit == alarmEnum.getBit()) {
                return alarmEnum.getAlarmId();
            }
        }
        return -1;
    }

    public static String getAlarmLevel(int bit) {
        for (AlarmEnum_2 alarmEnum : AlarmEnum_2.values()) {
            if (bit == alarmEnum.getBit()) {
                return alarmEnum.getAlarmLevel();
            }
        }
        return "";
    }

    public String getAlarmLevel() {
        return alarmLevel;
    }

    public void setAlarmLevel(String alarmLevel) {
        this.alarmLevel = alarmLevel;
    }

    public int getBit() {
        return bit;
    }

    public void setBit(int bit) {
        this.bit = bit;
    }

    public int getAlarmId() {
        return alarmId;
    }

    public void setAlarmId(int alarmId) {
        this.alarmId = alarmId;
    }

    public String getAlarmName() {
        return alarmName;
    }

    public void setAlarmName(String alarmName) {
        this.alarmName = alarmName;
    }
}
